<template>
	<view class="indexs">
		<view class="header header_wi" :style="'padding-top: ' + navH + 'px;'">
			<view class="header_height" :style="'height:' + gaodu + 'px;line-height:' + gaodu + 'px;top:' + gaodutops + 'px;'">
				<view class="index_h_cont3">
					<view class="index_wenben_img" @tap="jumpzuo"><image :src="imgUrl + '/dzx_img33.png'" mode="widthFix"></image></view>
					<view class="index_wenben">{{ $t('page_shenqingdb_renling_details.package_claim') }}</view>
				</view>
			</view>
			<view class="coloe_title">s</view>
		</view>
		<view class="index_center" :style="'padding-top:' + (navH + 50) + 'px;'">
			<view class="baoguo_renling_details">
				<view class="baoguo_renling_details_item">
					<view class="baoguo_renling_details_cont">
						<view class="baoguo_renling_details_cont_l">
							<image :src="imgUrl + '/dzx_img27.png'"></image>
							<text>{{ $t('page_shenqingdb_renling_details.tracking_number') }}</text>
						</view>
						<view class="baoguo_renling_details_cont_r">
							<input type="text" :placeholder="$t('page_shenqingdb_renling_details.please_enter_tracking_number')" @input="kauididanhaoFun" />
						</view>
					</view>
					<view class="baoguo_renling_details_cont" @tap="shangpinpinlei">
						<view class="baoguo_renling_details_cont_l">
							<image :src="imgUrl + '/dzx_img28.png'"></image>
							<text>{{ $t('page_shenqingdb_renling_details.commodity_category') }}</text>
						</view>
						<view class="baoguo_renling_details_cont_r">
							<text>{{ shangpinnames }}</text>
							<image :src="imgUrl + '/dzx_img25.png'"></image>
						</view>
					</view>
				</view>

				<view class="baoguo_renling_details_item2">
					<view class="baoguo_renling_details_btns" @tap="tijiao">{{ $t('page_shenqingdb_renling_details.submit') }}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
// pages/shouye/shouye_zkc/shouye_zkc.js
const app = getApp();

let request = require('../../../utils/require');

export default {
	data() {
		return {
			navH: app.globalData.navHeight,
			gaodu: app.globalData.height,
			gaodutops: app.globalData.top,
			imgUrl: app.globalData.imgUrl,
			shangpinids: '',
			shangpinnames: this.$t('page_other.请选择商品品类'),
			kauididanhao: ''
		};
	},
	/**
	 * 生命周期函数--监听页面加载
	 */ onLoad() {
		var that = this;
	},
	onShow() {
		var that = this;

		let pages = getCurrentPages();
		let currPage = pages[pages.length - 1];

		if (currPage.ids) {
			this.shangpinids =  currPage.ids				
			this.shangpinnames =  currPage.names				
		}
	},
	/**
	 * 生命周期函数--监听页面初次渲染完成
	 */
	onReady: function() {},
	/**
	 * 生命周期函数--监听页面隐藏
	 */
	onHide: function() {},
	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload: function() {},
	/**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
	onPullDownRefresh: function() {},
	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom: function() {},
	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage: function() {},
	methods: {
		//商品品类
		shangpinpinlei() {
			uni.navigateTo({
				url: '/pages/indexs/shangpinpinlei/shangpinpinlei'
			});
		},

		jumpzuo() {
			uni.navigateBack();
		},

		tijiao() {
			var that = this;

			if (that.kauididanhao == '') {
				uni.showToast({
					title:'还未填写快递单号',
					icon: 'none'
				});
			} else {
				var data = {
					express_sn: that.kauididanhao,
					class_ids: that.shangpinids,
					token: uni.getStorageSync('token')
				};
				request.post(`index.php?s=/api/package/getTakePackage&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
					if (res.data.code == 1) {
						uni.showToast({
							title: res.data.data
						});
						setTimeout(() => {
							uni.navigateBack({
								delta: 0
							});
						}, 1000);
					} else {
						uni.showToast({
							title: res.data.msg,
							icon: 'none'
						});
					}
				});
			}
		},

		kauididanhaoFun(e) {
			this.kauididanhao = e.detail.value
		}
	}
};
</script>
<style>
@import './shenqingdb_renling_details.css';
</style>
